package com.zl.csMall.code.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * @description: Knife4jConfig 接口文档生成工具配置
 * @author: ChenNing
 * @date 2025-10-17 16:53
 */
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfig {

    @Bean(value = "dockerBean")
    public Docket dockerBean() {
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .enable(true) // 是否开启 Swagger 文档，可根据环境动态配置
                .apiInfo(new ApiInfoBuilder()
                        .description("# 灿盛纺织内部API") // 描述字段支持 Markdown 语法
                        .termsOfServiceUrl("https://doc.xiaominfo.com/")
                        .contact("ChenNing")
                        .version("1.0")
                        .build());
        return docket;
    }

}
